import React from 'react';
import { useSelector, useDispatch } from 'react-redux'
type Props = {}

export default function Father({ }: Props) {
    const dispath = useDispatch();
    // 给state形参设置类型
    const state = useSelector((state: { count: number }) => state)
    // console.log(state);
    return (
        <div>
            <p onClick={() => {
                dispath({ type: '+', payload: 1 })
            }}>
                count: {state.count}
            </p>
        </div>
    )
}